/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ania2.gui;

import ania2.Move;
import java.util.LinkedList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author pawel
 */
public class MoveEstimationTableModel extends AbstractTableModel {

    private List<Move> dataList;

    public MoveEstimationTableModel(List<Move> dataList) {
        this.dataList = dataList;
    }

    public MoveEstimationTableModel() {
        this.dataList = new LinkedList<Move>();
    }

    public int getColumnCount() {
        return 3;
    }

    public int getRowCount() {
        return dataList.size();
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        if (columnIndex == 0) {
            return rowIndex + 1;
        } else if (columnIndex == 1) {
            return dataList.get(rowIndex).getShortNotation();
        } else {
            return dataList.get(rowIndex).getValue();
        }
    }

    public void setDataList(List<Move> dataList) {
        this.dataList = dataList;
    }

    @Override
    public String getColumnName(int c) {
        if (c == 0) {
            return "";
        } else if (c == 1) {
            return "Ruch";
        } else {
            return "Ocena";
        }
    }
}
